//
//  Array+Extension.swift
//  FrameProduct
//
//  Created by delegate on 2024/2/3.
//

import Foundation
extension Array where Element:Hashable {
    /// 过滤数组，使用`Set`进行过滤器
    /// 参考 https://www.logcg.com/archives/3177.html
    public var unique:[Element] {
        var uniq = Set<Element>()
        uniq.reserveCapacity(self.count)
        return self.filter {
            return uniq.insert($0).inserted
        }
    }
}
